package com.test.aliyun;

import lombok.Data;

@Data
public class MarryJsonResult {

    private Integer status;

    // 响应消息
    private String msg;

    // 响应中的数据
    private Object data;

    private String ok;	// 不使用

    public static MarryJsonResult build(Integer status, String msg, Object data) {
        return new MarryJsonResult(status, msg, data);
    }

    public static MarryJsonResult ok(Object data) {
        return new MarryJsonResult(data);
    }

    public static MarryJsonResult ok() {
        return new MarryJsonResult(null);
    }

    public static MarryJsonResult errorMsg(String msg) {
        return new MarryJsonResult(500, msg, null);
    }

    public static MarryJsonResult errorMap(Object data) {
        return new MarryJsonResult(501, "error", data);
    }

    public static MarryJsonResult errorTokenMsg(String msg) {
        return new MarryJsonResult(502, msg, null);
    }

    public static MarryJsonResult errorException(String msg) {
        return new MarryJsonResult(555, msg, null);
    }

    public MarryJsonResult() {

    }


    public MarryJsonResult(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public MarryJsonResult(Object data) {
        this.status = 200;
        this.msg = "OK";
        this.data = data;
    }

    public Boolean isOK() {
        return this.status == 200;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getOk() {
        return ok;
    }

    public void setOk(String ok) {
        this.ok = ok;
    }


}
